//
//  CHStringHash.m
//  Chocolat
//
//  Created by Pieter Omvlee on 8/15/08.
//  Copyright 2008 Insearchofaname. All rights reserved.
//

#import "CHStringHash.h"


@implementation NSString (CHStringHash)

- (NSData *)md5Hash
{
  NSData *data     = [self dataUsingEncoding:NSUTF8StringEncoding];
  
  NSMutableData *digest = [NSMutableData dataWithLength:MD5_DIGEST_LENGTH];
	if (digest && MD5([data bytes], [data length], [digest mutableBytes]))
		return digest;
  
  return nil;
}

@end
